<template>
  <div class="home">
    <p>{{ store.count }}</p>
    <p>{{ store.msg }}</p>
    <p>
      <button @click="changeStore">直接修改</button>
      <button @click="getListDatas">获取list数据</button>
    </p>
  </div>
</template>

<script setup>
import { useStore } from '@/store/index'
import { reactive } from 'vue';
let store = useStore();
console.log(store);

// 通过 store 实例访问 state，直接对其进行读写。
let changeStore = () => {
  store.count++;
}
let listParams = reactive({
  page: 1,
  size: 10,
  type: 'is_best'
})

let getListDatas = () => {
  store.changeHomeListDatas({
    page: listParams.page,
    size: listParams.size,
    type: listParams.type
  })
}
</script>
